package com.ztp.pc.gui;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.JSplitPane;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import java.awt.Component;
import javax.swing.BoxLayout;
import javax.swing.Box;

import com.ztp.pc.gui.gtabpane.GTabHeader;
import com.ztp.pc.gui.gtabpane.GTabPane;

import java.awt.SystemColor;
import java.awt.Insets;
import java.awt.Color;

public class Test {

	private JFrame frame;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
			//UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
			
		} catch (ClassNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (InstantiationException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IllegalAccessException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (UnsupportedLookAndFeelException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Test window = new Test();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Test() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new BorderLayout(0, 0));
		
		GTabPane tp = new GTabPane();
		tp.addCard(new JButton("test button"), "button");
		tp.addCard(new JLabel("test label"), "label");
		JPanel panel = new JPanel();
		panel.setLayout(new BorderLayout());
		panel.add(new JButton("north"),BorderLayout.NORTH);
		panel.add(new JButton("south"),BorderLayout.SOUTH);
		tp.addCard(panel, "panel");
		
		tp.addCard(new JPanel(), "panel2");
		tp.addCard(new JPanel(), "panel2");
		tp.addCard(new JPanel(), "panel2");
		tp.addCard(new JPanel(), "panel2");
		tp.addCard(new JPanel(), "panel2");
		
		//tp.addCtrlComponent(GTabHeader.createCloseButton());
		tp.addCtrlComponent(GTabHeader.createDefaultButton(GTabHeader.DEF_BTN_CLOSE));
		
		frame.getContentPane().add(tp, BorderLayout.CENTER);
	}
}
